<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=<device-width>, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id = "img1">
        <img src="./images/animal1.png" alt = "animal1"/>
    </div>
</body>
<script>
    /**
        document是整个网页文档的抽象，
        document.getElementById("con");
        表示在整个网页文档中，根据元素的id属性值获取
        到该元素的DOM节点对象
        */

        var con = document.getElementById("con");
        var img1 = document.getElementById("img1");

        img1.onclick = function(){
            /**
            * 在事件的回调函数中，this指向当前出发事件
            *   的DOM节点对象
            */
            this.style.border = "1px solid red";
        }
</script>
</html>